from machine import FPIOA
from machine import Pin
import time

fpioa=FPIOA()
#fpioa.help()  #获取引脚功能

#设置引脚功能
fpioa.set_function(53,FPIOA.GPIO53)
fpioa.set_function(62,FPIOA.GPIO62)
fpioa.set_function(20,FPIOA.GPIO20)
fpioa.set_function(63,FPIOA.GPIO63)

#将引脚赋值给对象
LED_R=Pin(62,Pin.OUT,pull=Pin.PULL_NONE,drive=7)
LED_G=Pin(20,Pin.OUT,pull=Pin.PULL_NONE,drive=7)
LED_B=Pin(63,Pin.OUT,pull=Pin.PULL_NONE,drive=7)
KEY=Pin(53,Pin.IN,pull=Pin.PULL_DOWN)

LED_R.high()
LED_G.high()
LED_B.high()

LED=LED_R
state=0;

while True:
    if KEY.value()==1:
        time.sleep(0.02)
        while(KEY.value()==1):
            pass
        time.sleep(0.02)
        state=(state+1)%2
    LED.value(state)


